$(function(){
    var lastSelection;
    
    var ExamesSel;
    var numNumExame =0;
	//Ativando a grid e setando as propriedades
	jQuery("#gridExame").jqGrid({
		caption: "", //Titulo da Grid
		url: "extranet/Solicitacao/getexames", //Url da requisi��o ajax para retornar os dados
                datatype: "json", //Tipo de dado retornado pela requisi��o
		colNames:['id','Exame', 'Obrigat&oacute;rio','Metodologia'], //Titulo das colunas
		colModel:[
			//Defini��o dos par�metros para os campos da grid
			{name:'idExame', index:'idExame', width:50, align:"center"},
			{name:'nomeLongo', index:'nomeLongo', width:180, align:"left"},
                        {name:'eObrigatorio', index:'eObrigatorio', width:50, align:"center"},
                        {name:'metodologia', index:'metodologia', width:200, align:"left"}
                       
		],
                onSelectRow: function(id){
                    if(id && id!=lastSelection){
                        var grid = $(this);
                        grid.restoreRow(lastSelection);
                        grid.editRow(id,true);
                        lastSelection=id;
                        ExamesSel = jQuery("#gridExame").getGridParam('selarrrow');
                        $('#ExameSel').val(ExamesSel);
                        
                        numNumExame = ExamesSel.length;
                        $('#qtdExameSel').val(numNumExame);
                            
                    }
                    
                   
                },               
                
		width: "900",  
		height: "100%", 
		pager: '#navExame',  
		sortname: "eObrigatorio",  
		sortorder: "DESC",  
		scroll: true,
                multiselect: true,  
		viewrecords: false,  
                subGrid: false
		}).navGrid("#navExame",{
		
		edit: false, 
		add: false, 
		del: false, 
		search: false, 
		view: false,
		refresh: true 
	});
     
});
jQuery("#gridExame").jqGrid('navGrid','#navExame',{edit:false,add:false,del:false});



